\(\int \frac {\cos (c+d x)}{(a+b \cos (c+d x))^2} \, dx\) [463]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F(-1)]
   Maxima [F(-2)]
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 19, antiderivative size = 85 \[ \int \frac {\cos (c+d x)}{(a+b \cos (c+d x))^2} \, dx=-\frac {2 b \arctan \left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{(a-b)^{3/2} (a+b)^{3/2} d}+\frac {a \sin (c+d x)}{\left (a^2-b^2\right ) d (a+b \cos (c+d x))} \]

[Out]

-2*b*arctan((a-b)^(1/2)*tan(1/2*d*x+1/2*c)/(a+b)^(1/2))/(a-b)^(3/2)/(a+b)^(3/2)/d+a*sin(d*x+c)/(a^2-b^2)/d/(a+
b*cos(d*x+c))

Rubi [A] (verified)

Time = 0.08 (sec) , antiderivative size = 85, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.211, Rules used = {2833, 12, 2738, 211} \[ \int \frac {\cos (c+d x)}{(a+b \cos (c+d x))^2} \, dx=\frac {a \sin (c+d x)}{d \left (a^2-b^2\right ) (a+b \cos (c+d x))}-\frac {2 b \arctan \left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{d (a-b)^{3/2} (a+b)^{3/2}} \]

[In]

Int[Cos[c + d*x]/(a + b*Cos[c + d*x])^2,x]

[Out]

(-2*b*ArcTan[(Sqrt[a - b]*Tan[(c + d*x)/2])/Sqrt[a + b]])/((a - b)^(3/2)*(a + b)^(3/2)*d) + (a*Sin[c + d*x])/(
(a^2 - b^2)*d*(a + b*Cos[c + d*x]))

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

Rule 211

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/Rt[a/b, 2]], x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rule 2738

Int[((a_) + (b_.)*sin[Pi/2 + (c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{e = FreeFactors[Tan[(c + d*x)/2], x
]}, Dist[2*(e/d), Subst[Int[1/(a + b + (a - b)*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}
, x] && NeQ[a^2 - b^2, 0]

Rule 2833

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(-(
b*c - a*d))*Cos[e + f*x]*((a + b*Sin[e + f*x])^(m + 1)/(f*(m + 1)*(a^2 - b^2))), x] + Dist[1/((m + 1)*(a^2 - b
^2)), Int[(a + b*Sin[e + f*x])^(m + 1)*Simp[(a*c - b*d)*(m + 1) - (b*c - a*d)*(m + 2)*Sin[e + f*x], x], x], x]
 /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 - b^2, 0] && LtQ[m, -1] && IntegerQ[2*m]

Rubi steps \begin{align*} \text {integral}& = \frac {a \sin (c+d x)}{\left (a^2-b^2\right ) d (a+b \cos (c+d x))}+\frac {\int \frac {b}{a+b \cos (c+d x)} \, dx}{-a^2+b^2} \\ & = \frac {a \sin (c+d x)}{\left (a^2-b^2\right ) d (a+b \cos (c+d x))}-\frac {b \int \frac {1}{a+b \cos (c+d x)} \, dx}{a^2-b^2} \\ & = \frac {a \sin (c+d x)}{\left (a^2-b^2\right ) d (a+b \cos (c+d x))}-\frac {(2 b) \text {Subst}\left (\int \frac {1}{a+b+(a-b) x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{\left (a^2-b^2\right ) d} \\ & = -\frac {2 b \arctan \left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{(a-b)^{3/2} (a+b)^{3/2} d}+\frac {a \sin (c+d x)}{\left (a^2-b^2\right ) d (a+b \cos (c+d x))} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.27 (sec) , antiderivative size = 83, normalized size of antiderivative = 0.98 \[ \int \frac {\cos (c+d x)}{(a+b \cos (c+d x))^2} \, dx=\frac {-\frac {2 b \text {arctanh}\left (\frac {(a-b) \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {-a^2+b^2}}\right )}{\left (-a^2+b^2\right )^{3/2}}+\frac {a \sin (c+d x)}{(a-b) (a+b) (a+b \cos (c+d x))}}{d} \]

[In]

Integrate[Cos[c + d*x]/(a + b*Cos[c + d*x])^2,x]

[Out]

((-2*b*ArcTanh[((a - b)*Tan[(c + d*x)/2])/Sqrt[-a^2 + b^2]])/(-a^2 + b^2)^(3/2) + (a*Sin[c + d*x])/((a - b)*(a
 + b)*(a + b*Cos[c + d*x])))/d

Maple [A] (verified)

Time = 0.96 (sec) , antiderivative size = 114, normalized size of antiderivative = 1.34

method result size
derivativedivides \(\frac {\frac {2 a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\left (a^{2}-b^{2}\right ) \left (\left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) a -b \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+a +b \right )}-\frac {2 b \arctan \left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{\left (a -b \right ) \left (a +b \right ) \sqrt {\left (a -b \right ) \left (a +b \right )}}}{d}\) \(114\)
default \(\frac {\frac {2 a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\left (a^{2}-b^{2}\right ) \left (\left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) a -b \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+a +b \right )}-\frac {2 b \arctan \left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{\left (a -b \right ) \left (a +b \right ) \sqrt {\left (a -b \right ) \left (a +b \right )}}}{d}\) \(114\)
risch \(-\frac {2 i a \left (a \,{\mathrm e}^{i \left (d x +c \right )}+b \right )}{b \left (-a^{2}+b^{2}\right ) d \left (b \,{\mathrm e}^{2 i \left (d x +c \right )}+2 a \,{\mathrm e}^{i \left (d x +c \right )}+b \right )}-\frac {b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {-i a^{2}+i b^{2}+a \sqrt {-a^{2}+b^{2}}}{\sqrt {-a^{2}+b^{2}}\, b}\right )}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right ) \left (a -b \right ) d}+\frac {b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right )}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right ) \left (a -b \right ) d}\) \(224\)

[In]

int(cos(d*x+c)/(a+cos(d*x+c)*b)^2,x,method=_RETURNVERBOSE)

[Out]

1/d*(2*a/(a^2-b^2)*tan(1/2*d*x+1/2*c)/(tan(1/2*d*x+1/2*c)^2*a-b*tan(1/2*d*x+1/2*c)^2+a+b)-2*b/(a-b)/(a+b)/((a-
b)*(a+b))^(1/2)*arctan((a-b)*tan(1/2*d*x+1/2*c)/((a-b)*(a+b))^(1/2)))

Fricas [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 321, normalized size of antiderivative = 3.78 \[ \int \frac {\cos (c+d x)}{(a+b \cos (c+d x))^2} \, dx=\left [\frac {{\left (b^{2} \cos \left (d x + c\right ) + a b\right )} \sqrt {-a^{2} + b^{2}} \log \left (\frac {2 \, a b \cos \left (d x + c\right ) + {\left (2 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} + 2 \, \sqrt {-a^{2} + b^{2}} {\left (a \cos \left (d x + c\right ) + b\right )} \sin \left (d x + c\right ) - a^{2} + 2 \, b^{2}}{b^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + a^{2}}\right ) + 2 \, {\left (a^{3} - a b^{2}\right )} \sin \left (d x + c\right )}{2 \, {\left ({\left (a^{4} b - 2 \, a^{2} b^{3} + b^{5}\right )} d \cos \left (d x + c\right ) + {\left (a^{5} - 2 \, a^{3} b^{2} + a b^{4}\right )} d\right )}}, -\frac {{\left (b^{2} \cos \left (d x + c\right ) + a b\right )} \sqrt {a^{2} - b^{2}} \arctan \left (-\frac {a \cos \left (d x + c\right ) + b}{\sqrt {a^{2} - b^{2}} \sin \left (d x + c\right )}\right ) - {\left (a^{3} - a b^{2}\right )} \sin \left (d x + c\right )}{{\left (a^{4} b - 2 \, a^{2} b^{3} + b^{5}\right )} d \cos \left (d x + c\right ) + {\left (a^{5} - 2 \, a^{3} b^{2} + a b^{4}\right )} d}\right ] \]

[In]

integrate(cos(d*x+c)/(a+b*cos(d*x+c))^2,x, algorithm="fricas")

[Out]

[1/2*((b^2*cos(d*x + c) + a*b)*sqrt(-a^2 + b^2)*log((2*a*b*cos(d*x + c) + (2*a^2 - b^2)*cos(d*x + c)^2 + 2*sqr
t(-a^2 + b^2)*(a*cos(d*x + c) + b)*sin(d*x + c) - a^2 + 2*b^2)/(b^2*cos(d*x + c)^2 + 2*a*b*cos(d*x + c) + a^2)
) + 2*(a^3 - a*b^2)*sin(d*x + c))/((a^4*b - 2*a^2*b^3 + b^5)*d*cos(d*x + c) + (a^5 - 2*a^3*b^2 + a*b^4)*d), -(
(b^2*cos(d*x + c) + a*b)*sqrt(a^2 - b^2)*arctan(-(a*cos(d*x + c) + b)/(sqrt(a^2 - b^2)*sin(d*x + c))) - (a^3 -
 a*b^2)*sin(d*x + c))/((a^4*b - 2*a^2*b^3 + b^5)*d*cos(d*x + c) + (a^5 - 2*a^3*b^2 + a*b^4)*d)]

Sympy [F(-1)]

Timed out. \[ \int \frac {\cos (c+d x)}{(a+b \cos (c+d x))^2} \, dx=\text {Timed out} \]

[In]

integrate(cos(d*x+c)/(a+b*cos(d*x+c))**2,x)

[Out]

Timed out

Maxima [F(-2)]

Exception generated. \[ \int \frac {\cos (c+d x)}{(a+b \cos (c+d x))^2} \, dx=\text {Exception raised: ValueError} \]

[In]

integrate(cos(d*x+c)/(a+b*cos(d*x+c))^2,x, algorithm="maxima")

[Out]

Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(4*b^2-4*a^2>0)', see `assume?`
 for more de

Giac [A] (verification not implemented)

none

Time = 0.31 (sec) , antiderivative size = 135, normalized size of antiderivative = 1.59 \[ \int \frac {\cos (c+d x)}{(a+b \cos (c+d x))^2} \, dx=\frac {2 \, {\left (\frac {{\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (-2 \, a + 2 \, b\right ) + \arctan \left (-\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {a^{2} - b^{2}}}\right )\right )} b}{{\left (a^{2} - b^{2}\right )}^{\frac {3}{2}}} + \frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{{\left (a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + a + b\right )} {\left (a^{2} - b^{2}\right )}}\right )}}{d} \]

[In]

integrate(cos(d*x+c)/(a+b*cos(d*x+c))^2,x, algorithm="giac")

[Out]

2*((pi*floor(1/2*(d*x + c)/pi + 1/2)*sgn(-2*a + 2*b) + arctan(-(a*tan(1/2*d*x + 1/2*c) - b*tan(1/2*d*x + 1/2*c
))/sqrt(a^2 - b^2)))*b/(a^2 - b^2)^(3/2) + a*tan(1/2*d*x + 1/2*c)/((a*tan(1/2*d*x + 1/2*c)^2 - b*tan(1/2*d*x +
 1/2*c)^2 + a + b)*(a^2 - b^2)))/d

Mupad [B] (verification not implemented)

Time = 15.17 (sec) , antiderivative size = 99, normalized size of antiderivative = 1.16 \[ \int \frac {\cos (c+d x)}{(a+b \cos (c+d x))^2} \, dx=\frac {2\,a\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left (a+b\right )\,\left (a-b\right )\,\left (\left (a-b\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+a+b\right )}-\frac {2\,b\,\mathrm {atan}\left (\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (2\,a-2\,b\right )}{2\,\sqrt {a+b}\,\sqrt {a-b}}\right )}{d\,{\left (a+b\right )}^{3/2}\,{\left (a-b\right )}^{3/2}} \]

[In]

int(cos(c + d*x)/(a + b*cos(c + d*x))^2,x)

[Out]

(2*a*tan(c/2 + (d*x)/2))/(d*(a + b)*(a - b)*(a + b + tan(c/2 + (d*x)/2)^2*(a - b))) - (2*b*atan((tan(c/2 + (d*
x)/2)*(2*a - 2*b))/(2*(a + b)^(1/2)*(a - b)^(1/2))))/(d*(a + b)^(3/2)*(a - b)^(3/2))